/* 
 * MySql DDL script for data integrity
 * 
 * This DDL script was generated automatically with the pmMDA generator. Do 
 * not modify the content. The content of the file will be overrwritten if
 * this script is regenerated.
 */
 

/* Table EMPLOYEE */
DROP TABLE IF EXISTS EMPLOYEE;
CREATE TABLE EMPLOYEE (
  ID INTEGER NOT NULL AUTO_INCREMENT,
  NAME VARCHAR(255) NOT NULL,
  ISMALE INTEGER NOT NULL,
  SALARY DOUBLE NOT NULL,
  GRADE INTEGER NOT NULL,
  DEPARTMENT_FK INTEGER,
  DEPARTMENT_EmployeeColumn_FK INTEGER,
  PRIMARY KEY(ID)
) TYPE=InnoDB;

CREATE UNIQUE INDEX EMPLOYEE_IDX ON 
  EMPLOYEE (ID);

/* Table DEPARTMENT */
DROP TABLE IF EXISTS DEPARTMENT;
CREATE TABLE DEPARTMENT (
  ID INTEGER NOT NULL AUTO_INCREMENT,
  NAME VARCHAR(255) NOT NULL,
  FOUNDATION DATETIME NOT NULL,
  QUALITYLEVEL INTEGER NOT NULL,
  MANAGER_FK INTEGER,
  COMPANY_FK INTEGER,
  COMPANY_DepartmentColumn_FK INTEGER,
  PRIMARY KEY(ID)
) TYPE=InnoDB;

CREATE UNIQUE INDEX DEPARTMENT_IDX ON 
  DEPARTMENT (ID);

/* Table COMPANY */
DROP TABLE IF EXISTS COMPANY;
CREATE TABLE COMPANY (
  ID INTEGER NOT NULL AUTO_INCREMENT,
  FOUNDATION DATETIME NOT NULL,
  NAME VARCHAR(255) NOT NULL,
  CHIEFEXECUTIVEOFFICER_FK INTEGER,
  PRIMARY KEY(ID)
) TYPE=InnoDB;

CREATE UNIQUE INDEX COMPANY_IDX ON 
  COMPANY (ID);
